﻿<%@ Page Title="" Language="C#" MasterPageFile="~/skin.Master" AutoEventWireup="true" CodeBehind="WorkSheet.aspx.cs" Inherits="DataShow.work.WorkSheet" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<asp:Content ID="headers" ContentPlaceHolderID="home_header" runat="server">
    <link rel="stylesheet" href="/css/compiled/form-showcase.css" type="text/css" media="screen" />
    <link href="/css/lib/bootstrap.datepicker.css" type="text/css" rel="stylesheet" />
    <link href="/fileupload/uploadify.css" rel="stylesheet" />
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="cph_home" runat="server">
    <div style="margin-top: 10px;">
        <ul class="breadcrumb">
            <li><a href="/Index.aspx">首页</a> <span class="divider">/</span></li>
            <li class="active">预报员排班</li>
        </ul>
    </div>
    <div class="row-fluid">
        <div class="span12">
            <div class="widget-box">
                <div class="widget-title">
                    <span class="icon">
                        <i class="icon-plus"></i>
                    </span>
                    <h5>功能栏</h5>
                </div>
                <div class="widget-content nopadding">
                    <asp:Button runat="server" ID="btn_search_all" Text="查询" CssClass="btn-primary btn" OnClick="btn_search_all_Click" />
                    <button class="btn btn-primary" data-toggle="modal" data-target="#myModal">
                        导入
                    </button>

                    <asp:Button runat="server" ID="btn_delete" Text="删除选中" CssClass="btn-primary btn" OnClick="btn_delete_Click" />
                    <asp:Button runat="server" ID="btn_check_all" Text="全选" CssClass="btn-primary btn" OnClick="btn_check_all_Click" />
                </div>
            </div>
        </div>

    </div>
    <div class="row-fluid">
        <div class="span12">
            <div class="widget-box" style="margin-top: 0">
                <div class="widget-title">
                    <span class="icon">
                        <i class="icon-plus"></i>
                    </span>
                    <h5>搜索结果</h5>
                </div>
                <div class="widget-content nopadding">
                    <asp:GridView ID="gv_result" runat="server" AutoGenerateColumns="False" BorderWidth="0" EmptyDataText="暂无排班表" CssClass="table" GridLines="None">
                        <Columns>
                            <asp:TemplateField HeaderText="ID" HeaderStyle-CssClass="w15" Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="ID" runat="server" Text='<%#Eval("id") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="选择">
                                <ItemTemplate>
                                    <asp:CheckBox runat="server" ID="Select" Checked="false" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="日期" HeaderStyle-CssClass="w15">
                                <ItemTemplate>
                                    <asp:Label ID="labdate" runat="server"><%#Eval("realdate").ToString().Split(' ')[0] %></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="站点" HeaderStyle-CssClass="w15">
                                <ItemTemplate>
                                    <asp:Label ID="labName" runat="server"><%#Eval("station") %></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="时效" HeaderStyle-CssClass="w15">
                                <ItemTemplate>
                                    <asp:Label ID="labScene" runat="server"><%#Eval("span_kind") %></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="起报时间" HeaderStyle-CssClass="w10">
                                <ItemTemplate>
                                    <asp:Label ID="labPoint" runat="server"><%#(Eval("clock")) %></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="发报时刻" HeaderStyle-CssClass="w20">
                                <ItemTemplate>
                                    <asp:Label ID="labSendPoint" runat="server"><%#Eval("sendpoint") %></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="当值预报员号" HeaderStyle-CssClass="w40">
                                <ItemTemplate>
                                    <asp:Label ID="labEID" runat="server"><%#Eval("forecastnumber" )%></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>

                        </Columns>
                    </asp:GridView>
                    <div class="alert" id="div_nodata" runat="server">
                        <i class="icon-warning-sign"></i>
                        暂无排班表
                    </div>
                    <webdiyer:AspNetPager ID="anp" runat="server" CustomInfoHTML="总计%RecordCount%条记录"
                        FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" OnPageChanged="anp_PageChanged"
                        PrevPageText="上一页" ShowCustomInfoSection="Left" ShowPageIndexBox="Never" PageSize="20"
                        CssClass="paginator" CurrentPageButtonClass="cpb" AlwaysShow="True" CustomInfoSectionWidth="250px">
                    </webdiyer:AspNetPager>
                </div>
            </div>
        </div>

    </div>
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title" id="myModalLabel">请选择上传文件</h4>
                </div>
                <div class="modal-body">
                    <div style="display: inline-block; float: left">
                        <input type="file" name="file_upload" id="file_upload">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn-danger btn" data-dismiss="modal">取消</button>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
<asp:Content runat="server" ID="scripts" ContentPlaceHolderID="home_script">
    <script src="/js/bootstrap.datepicker.js"></script>
    <script src="/fileupload/jquery.uploadify.js"></script>
    <script type="text/javascript">
        $(function () {

            // datepicker plugin
            $('.datepicker').datepicker().on('changeDate', function (ev) {
                $(this).datepicker('hide');
            });


            $('#file_upload').uploadify({
                'swf': '/fileupload/uploadify.swf',
                'uploader': '/work/HandleFile.ashx',
                'onUploadSuccess': function (file, data, response) {
                    //alert('The file ' + file.name + ' was successfully uploaded with a response of ' + response + ':' + data);
                    if (response == false) {
                        alert("服务器错误");
                    }
                    else {
                        if (data == "1") {
                            alert("全部数据导入成功");
                            $('#myModal').modal('hide');
                        }
                        else if (data == "0") {
                            alert("没有传入文件");
                        }
                        else {
                            alert(data);
                        }
                    }
                }

            });
        });
    </script>
</asp:Content>
